refactor/shrink roland comments#353
Conversation
Signed-off-by: Stevan A <stevana@users.noreply.github.com>
Signed-off-by: Stevan A <stevana@users.noreply.github.com>
Signed-off-by: Stevan A <stevana@users.noreply.github.com>
WalkthroughAlrighty mate, here’s the lowdown: Generator functions in the simulator got a facelift, now using closures that take Changes
Sequence Diagram(s)sequenceDiagram
participant TestRunner
participant GeneratorClosure
participant RNG
TestRunner->>GeneratorClosure: call(size, &mut RNG)
GeneratorClosure->>RNG: generate values
GeneratorClosure-->>TestRunner: return Vec<...>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov Report❌ Patch coverage is
... and 72 files with indirect coverage changes 🚀 New features to boost your workflow:
|
| ) | ||
| } | ||
|
|
||
| const ECHO_GENERATOR: fn(&mut StdRng) -> Vec<Reverse<Entry<EchoMessage>>> = { |
There was a problem hiding this comment.
Any particular reason to use a const here and not just a plain function?
| last_error = result; | ||
| input = complement; | ||
| n = n.max(2) - 1; | ||
| n = (n - 1).max(2); |
There was a problem hiding this comment.
Couldn't n become < 1 due to the !some_complement_is_failing branch below?
There was a problem hiding this comment.
No? n is initial 2 and while input.len() >= 2 we potentially update it, in the branch you mention, to n = (n * 2).min(input.len()).
There was a problem hiding this comment.
Ah! My bad; I missed the while input.len() >= 2 🤦
Signed-off-by: Stevan A <stevana@users.noreply.github.com>
Address @rkuhn's comments in #345 (review).
Summary by CodeRabbit
Refactor
Bug Fixes